package com.gitee.wsl.struct.either.ext

import arrow.core.Either

/**
 * Given [B] is a sub type of [C], re-type this value from Either<A, B> to Either<A, C>
 *
 * ```kotlin
 * import arrow.core.*
 *
 * fun main(args: Array<String>) {
 *   //sampleStart
 *   val string: Either<Int, String> = "Hello".right()
 *   val chars: Either<Int, CharSequence> =
 *     string.widen<Int, CharSequence, String>()
 *   //sampleEnd
 *   println(chars)
 * }
 * ```
 * <!--- KNIT example-either-44.kt -->
 */
fun <A, C, B : C> Either<A, B>.widen(): Either<A, C> = this

fun <AA, A : AA, B> Either<A, B>.leftWiden(): Either<AA, B> = this
